const jwt = require('jwt-simple')

const secret = 'ljsoiu1283497ksdf12348,12341289jas.akdflj!asdofjoi9ADFKLkasndf'

module.exports = {
  // 生成 token
  generateToken(payload) {
    return jwt.encode(payload, secret)
  },
  // 验证 token
  verify(token) {
    return jwt.decode(token, secret)
  }
}
